<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<?php echo base_url();?>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>main</title>
<link rel="stylesheet" type="text/css" href="style/admin.css" />
</head>
<body id="main">

<div class="map">
	内容管理 &gt;&gt; 设置网站导航 &gt;&gt; <strong id="title">导航列表</strong>
</div>

<ol>
	<li><?=anchor('admin/nav/nav_list','导航列表',array('target'=>'main','class'=>'selected'))?></li>
	<li><?=anchor('admin/nav/nav_add','新增导航(一级)','target="main"')?></li>
</ol>
<?php if ($nav == 'nav_list'){?>
<form method="post" action="nav.php?action=sort">
<table cellspacing="0">
	<tr><th>Id</th><th>导航名称</th><th>Pid</th><th>描述</th><th>子类</th><th>操作</th></tr>
	<?php if(!empty($all_nav)):?>
	<?php foreach($all_nav as $rows):?>
	<tr>
		<td><?=$rows->id?></td>
		<td><?=$rows->nav_name?></td>
		<td><?=$rows->pid?></td>
		<td><?=$rows->nav_info?></td>
		<td><?=anchor('admin/nav/nav_child_list/'.$rows->id,'查看子类','target="main"')?> | <?=anchor('admin/nav/nav_child_add/'.$rows->id,'增加子类','target="main"')?></td>
		<td><?=anchor('admin/nav/nav_update/'.$rows->id,'修改','target="main"')?> | <?=anchor('admin/delete_nav/'.$rows->id,'删除','target="main"')?></td>
	</tr>
	<?php endforeach;?>
	<?php else:?>
	<tr><td colspan="6">对不起，没有任何数据</td></tr>
	<?php endif;?>
</table>
</form>
<div id="page">分页内容</div>
<?php }?>

<?php if($nav == 'nav_add'){?>
	<form method="post" name="add" action="<?=site_url('admin/add_nav')?>">
	<table cellspacing="0" class="left">
		<tr><td>导航名称：<input type="text" name="nav_name" class="text" /> (* 导航名称不得小于两位，不得大于20位！)</td></tr>
		<tr><td><textarea name="nav_info"></textarea> (* 描述不得大于200位！)</td></tr>
		<tr><td><input type="submit" name="submit" value="新增导航"  class="submit level" /> [ <a href="{$prev_url}">返回列表</a> ]</td></tr>
	</table>
</form>
<?php }?>

<?php if($nav == 'nav_update'){?>
	<form method="post" name="add" action="<?=site_url('admin/update_nav/'.$id)?>">
	<input type="hidden" value="<?=$id?>" name="id" />
	<table cellspacing="0" class="left">
		<tr><td>导航名称：<input type="text" name="nav_name" value="<?=$get_one_nav[0]->nav_name?>" class="text" /> (* 导航名称不得小于两位，不得大于20位！)</td></tr>
		<tr><td><textarea name="nav_info"><?=$get_one_nav[0]->nav_info?></textarea> (* 描述不得大于200位！)</td></tr>
		<tr><td><input type="submit" name="submit" value="修改导航"  class="submit level" /> [ <a href="#">返回列表</a> ]</td></tr>
	</table>
</form>
<?php }?>

<?php if($nav == 'nav_child_list'){?>
	<table cellspacing="0">
	<tr><th>编号</th><th>导航名称</th><th>描述</th><th>操作</th></tr>
	<?php if(!empty($all_child_nav)):?>
	<?php foreach ($all_child_nav as $rows):?>
	<tr>
		<td><?=$rows->id?></td>
		<td><?=$rows->nav_name?></td>
		<td><?=$rows->nav_info?></td>
		<td><?=anchor('admin/nav/nav_child_update/'.$rows->id,'修改','target="main"')?> | <?=anchor('admin/delete_child_nav/'.$rows->id.'/'.$get_one_nav[0]->id,'删除')?></td>
	</tr>
	<?php endforeach;?>
	<?php else:?>
	<tr><td colspan="4">对不起，没有任何数据</td></tr>
	<?php endif;?>
	<tr><td colspan="4">本类隶属：<strong><?=$get_one_nav[0]->nav_name?></strong> [ <a href="#">增加本类</a> ] [ <a href="#">返回列表</a> ]</td></tr>
</table>
<div id="page">分页信息</div>
<?php }?>


<?php if($nav == 'nav_child_add'){?>
	<form method="post" name="add" action="<?=site_url('admin/add_nav_child/'.$get_one_nav[0]->id)?>">
	<input type="hidden" value="<?=$get_one_nav[0]->id?>" name="id" />
	<table cellspacing="0" class="left">
		<tr><td>上级导航：<strong><?=$get_one_nav[0]->nav_name?></strong></td></tr>
		<tr><td>导航名称：<input type="text" name="nav_name" class="text" /> (* 导航名称不得小于两位，不得大于20位！)</td></tr>
		<tr><td><textarea name="nav_info"></textarea> (* 描述不得大于200位！)</td></tr>
		<tr><td><input type="submit" name="submit" value="新增子导航"  class="submit level" /> [ <a href="#">返回列表</a> ]</td></tr>
	</table>
</form>
<?php }?>
<?php if($nav == 'nav_child_update'){?>
	<form method="post" name="add" action="<?=site_url('admin/update_nav_child')?>">
	<input type="hidden" name="id" value="<?=$id?>" />
	<table cellspacing="0" class="left">
		<tr><td>导航名称：<input type="text" name="nav_name" value="<?=$get_one_nav[0]->nav_name?>" class="text" /> (* 导航名称不得小于两位，不得大于20位！)</td></tr>
		<tr><td><textarea name="nav_info"><?=$get_one_nav[0]->nav_info?></textarea> (* 描述不得大于200位！)</td></tr>
		<tr><td><input type="submit" name="submit" value="修改子导航"  class="submit level" /> [ <a href="#">返回列表</a> ]</td></tr>
	</table>
</form>
<?php }?>
</body>
</html>